<script setup lang="ts">
import notice from "@/components/notice.vue"
import 'element-plus/dist/index.css'
import defaultDesktop from "@/assets/defaultDesktop"
import allWeiget from "@/assets/allWeiget"
import { useMainStore } from "@/store/mainStore"
import application from "@/application/application.vue"
import getToken from "@/api/token"

function saveDefaultDesktop() {
    localStorage.setItem('desktop', JSON.stringify(defaultDesktop.map((page) => page.map((w) => allWeiget[w as keyof typeof allWeiget]))))
}
try {
    (localStorage.desktop && JSON.parse(localStorage.desktop)) || saveDefaultDesktop()
} catch {
    saveDefaultDesktop()
}

Object.defineProperty(window, 'getTokenList', {
    value: getToken,
    writable: false,
    enumerable: false,
    configurable: false
});

let mainStore = useMainStore()

mainStore.initSafeEye()

</script>

<template>
    <notice></notice>
    <div style="height:28px"></div>
    <router-view></router-view>

    <application v-for="(actApp, index) in mainStore.activeAppList" :packageName="actApp.packageName"
        :key="actApp.packageName + index" :id="actApp.packageName + index"></application>
</template>

<style scoped></style>
